namespace ShellNavigator.Client.Models
{
  #region

  using System;

  using ShellNavigator.Client.Core;

  #endregion

  /// <summary>
  ///     The file target.
  /// </summary>
  public class FileInfo : InfoBase
  {
    #region Constants and Fields

    public FileInfo()
    {
    }

    public FileInfo(FileInfo origin, ProjectInfo parentProject)
    {
      this.ParentProject = parentProject;
      this.Name = origin.Name;
      this.TextLine = origin.TextLine;
    }

    /// <summary>
    ///     Gets FileExtension.
    /// </summary>
    public static readonly string[] ExcludeExtensions = new[]
      {
        "*.dll", "*.exe", "*.obj", "*.bin", "*.pdb", "*.mdb", "*.suo"
      };

    #endregion

    #region Public Properties

    public string Name { get; set; }

    public string TextLine { get; set; }

    public ProjectInfo ParentProject { get; private set; }

    #endregion

    #region Public Methods

    public override void RunAction(AppActions action)
    {
      switch (action)
      {
        case AppActions.OpenSolution:
          ShellExecutor.OpenStudio(this.ParentProject.ParentSolution.Name, this.Name);
          break;
        case AppActions.OpenProject:
          ShellExecutor.OpenStudio(this.ParentProject.Name, this.Name);
          break;
        case AppActions.OpenFile:
          ShellExecutor.OpenShell(this.Name);
          break;
        case AppActions.CopyFile:
          ShellExecutor.CopyToClipboard(this.Name);
          break;
        case AppActions.CopyProject:
          ShellExecutor.CopyToClipboard(this.ParentProject.Name);
          break;
        case AppActions.CopyAssembly:
          ShellExecutor.CopyAssemblyName(this.ParentProject.Name);
          break;
        case AppActions.CopySolution:
          ShellExecutor.CopyToClipboard(this.ParentProject.ParentSolution.Name);
          break;
      }
    }

    #endregion
  }
}